#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int waysToMakeFair(int* nums, int numsSize) {
    int prev1 = 0, prev2 = 0, next1 = 0, next2 = 0;
    int count = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (i % 2)
        {
            next1 += nums[i];
        }
        else
        {
            next2 += nums[i];
        }
    }
    for (int i = 0; i < numsSize; i++)
    {
        if (i % 2)
        {
            next1 -= nums[i];
        }
        else
        {
            next2 -= nums[i];
        }
        if (next1 + prev2 == next2 + prev1)
        {
            count++;
        }
        if (i % 2)
        {
            prev1 += nums[i];
        }
        else
        {
            prev2 += nums[i];
        }
    }
    return count;
}

int main()
{
    int arr[] = { 2,1,6,4 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    printf("%d ",waysToMakeFair(arr, sz));
    return 0;
}